(1) Field of the Invention
The present invention relates to a data holding apparatus used for an image coding apparatus and an image decoding apparatus which respectively codes and decodes an image on a macroblock basis while switching a field structure and a frame structure adaptively on a macroblock pair basis.
(2) Description of the Related Art
FIG. 1 is a block diagram showing a structure of a conventional data holding apparatus included in an image coding apparatus and an image decoding apparatus which are compliant with the MPEG-2 standard (see INTERNATIONAL STANDARD ISO/IEC 13818-2: 2000, “Information technology-Generic coding of moving pictures and associated audio information: Video”). In FIG. 1, the data holding apparatus includes registers 501 to 503, a parameter line memory 504 and a condition judgment circuit 505.
The register 501 holds a parameter set of a current macroblock to be coded or decoded (hereinafter referred to as a current macroblock). FIG. 2 shows the coding or decoding order of macroblocks. As shown in FIG. 2, macroblocks which make up a single picture are coded one by one by scanning the horizontal macroblock lines in a direction from left to right and from top to bottom.
The registers 502 and 503 hold parameter sets of previously coded or decoded macroblocks. More specifically, the register 502 holds the parameter set of the macroblock immediately left of a current macroblock, while the register 503 holds the parameter set of the macroblock immediately above the current macroblock, as shown in FIG. 3. Here, a parameter set includes motion vectors of a macroblock and the like, and indicates the conditions for coding or decoding the macroblock.
The parameter line memory 504 holds parameter sets of previously coded or decoded macroblocks. More specifically, it holds the parameter sets of respective macroblocks in the macroblock line immediately above the macroblock line which contains a current macroblock. The parameter line memory 504 holds parameter sets of previously coded or decoded macroblocks because a current macroblock refers to a previously coded or decoded macroblock contained in the above neighboring macroblock line. Here, a macroblock located right to the current macroblock is a macroblock to be coded or decoded next. A macroblock in a macroblock line just below the macroblock line of the current macroblock is to be coded or decoded after the coding or decoding of macroblocks corresponding to one macroblock line.
The condition judgment circuit 505 judges the coding or decoding conditions for a current macroblock based on the parameter sets stored in the registers 501 to 503.
In the data holding apparatus shown in FIG. 1, before a current macroblock is processed (coded or decoded), the parameter set of the most recently processed macroblock is transferred, as the parameter set of the left neighboring macroblock, from the register 501 to the register 502 for the left neighboring macroblock. At the same time, the parameter set of the macroblock, which has already been processed for one macroblock line before the processing of the current macroblock and saved in the parameter line memory 504, is read out as the parameter set of the above neighboring macroblock and stored in the register 503. A current macroblock is processed (coded or decoded) based on a parameter set of the current macroblock, stored in the register 501, a parameter set of the left neighboring macroblock, stored in the register 502, and a parameter set for the above neighboring macroblock, stored in the register 503. The condition judgment circuit 505 judges the conditions for coding (or decoding) the current macroblcok using the above parameters.
As described above, after the coding (or decoding) of a current macroblock has been completed, the parameter set of the current macroblock, stored in the register 501, is transferred to the register 502 because such parameter set will be needed again as the parameter set of the left neighboring macroblock when the macroblock immediately right of the current macroblock becomes a current macroblock to be coded (or decoded) next. At the same time, the parameter set of the current macroblock, stored in the register 501, is saved in the parameter line memory 504 because it will be needed again as the parameter set of the above neighboring macroblock when the macroblock immediately below the current macroblock becomes a current macroblock to be coded (or decoded) next.
A series of processing as mentioned above is repeated on a macroblock basis for coding (or decoding) of the whole picture.